<?php
/**
 * Created by JetBrains PhpStorm.
 * User: Grom Hellscream
 * Date: 11/1/12
 * Time: 11:07 PM
 * To change this template use File | Settings | File Templates.
 */
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
$document = JFactory::getDocument();

$phongs = $this->get('phongs');
$donvi = $this->get('donvi');
$khoi = $this->get('khoi');
$pagination = $this->get('pagination');

?>

<div id="crumbs">
    <div style="color: #222222;font-weight: normal;margin: 0;padding: 0">
        <a href="<?php echo JRoute::_('index.php?option=com_vast&view=vast') ?>">Trang chủ</a> »
        <span>Cơ cấu tổ chức</span> »
        <a href="<?php echo JRoute::_('index.php?option=com_vast&view=donvitructhuoc&id=' . $khoi->id); ?>"><?php echo $khoi->ten ?></a> »        
        <span><?php echo $donvi->ten; ?></span>
    </div>
</div>

<div id="main" class="home">
    <h3 class="title green">Các phòng trực thuộc <?php echo $donvi->ten; ?></h3>
    <div class="single">
        <?php
        foreach ($phongs as $phong)
        {
            ?>
            <div>
                <table>
                    <tr>
                        <td style="padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px;">
                            <?php if (file_exists($phong->hinhanh)) { ?>
                                <img width="180" height="125" src="<?php echo $phong->hinhanh; ?>" alt="<?php echo $phong->ten; ?>"/>
                            <?php } else { ?>
                                <img width="180" height="125" src="<?php echo $this->baseurl . '/media/com_vast/images/default_image.jpg'; ?>" alt="<?php echo $donvi->ten; ?>"/>
                            <?php } ?>
                        </td>
                        <td width="100%" valign="top" style="padding: 5px;">
                            <a href="index.php?option=com_vast&view=canbotructhuoc&id=<?php echo $phong->id; ?>">
                                <?php echo $phong->ten; ?>
                            </a>
                            <br/>
                            <?php echo $phong->tomtat; ?>
                            <br/>
                            Điện thoại: <?php echo $phong->sodienthoai; ?>
                            <br/>
                            <a href="<?php echo JRoute::_('index.php?option=com_vast&view=chitietphong&id=' . $phong->id); ?>">
                                <img src="<?php echo $this->baseurl . '/components/com_vast/assets/images/view.png'; ?>" />
                            </a>
                            <?php if (JFactory::getUser()->authorise('vast.phong.manage', 'com_vast') || JFactory::getUser()->authorise('vast.phong.edit', 'com_vast')): ?>
                            <a href="<?php echo JRoute::_('index.php?option=com_vast&view=phong&layout=edit&id=' . $phong->id); ?>">
                                <img src="<?php echo $this->baseurl . '/components/com_vast/assets/images/update.png'; ?>" />                            
                            </a>
                            <?php endif; ?>
                            <?php if (JFactory::getUser()->authorise('vast.phong.manage', 'com_vast') || JFactory::getUser()->authorise('vast.phong.delete', 'com_vast')): ?>
                            <a onclick="return confirm('Bạn có thực sự muốn xóa phòng này ?');" href="<?php echo JRoute::_('index.php?option=com_vast&task=phong.delete&id=' . $phong->id); ?>">
                                <img src="<?php echo $this->baseurl . '/components/com_vast/assets/images/delete.png'; ?>" />                            
                            </a>
                            <?php endif; ?>                            
                            <a class="readon" href="index.php?option=com_vast&view=chitietphong&id=<?php echo $phong->id; ?>">Đọc thêm ...</a>
                        </td>
                    </tr>
                </table>
                <hr style="height: 0px; border-top-color: #00ccff; border-right-color: #00ccff; border-bottom-color: #00ccff; border-left-color: #00ccff; border-top-width: 1px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-top-style: dashed; border-right-style: dashed; border-bottom-style: dashed; border-left-style: dashed;"/>
            </div>
            <?php
        }
        ?>
    </div>
    <div id="tnt_pagination">
        <?php
        echo $pagination->getPagesLinks();
        ?>
    </div>
</div>